package cn.netdisk.tinynetdisk.common.enums;

/**
 * @Author: chenlb
 * @Date: 2020/05/11 10:37
 * @Description:
 */
public enum CodeEnum implements ICodeEnum {

    SUCCESS(0, "操作成功"),
    ERROR(1, "操作失败"),
    NEED_LOGIN(10, "账户未登录"),
    ILLEGAL_ARGUMENT(2, "参数不合法"),
    SYSTEM_BUSY(-1, "系统繁忙"),
    SYSTEM_ERROR(-2, "系统错误"),
    UPLOAD_ERROR(-3, "文件上传错误"),
    UPLOAD_ERROR_NOTNULL(-4, "文件不能为空"),

    NOT_ACCOUNT(20, "账号不能为空"),
    NOT_PASSWORD(21, "密码不能为空"),
    NOT_CODE(22, "验证码不能为空"),
    NOT_USER_ACCOUNT(23, "账户不存在"),
    NOT_TOKEN(24, "token不存在"),
    NOT_SIGN(25, "签名不能为空"),
    NOT_POWER(26, "该用户无权限操作"),
    NOT_PARAM(27, "缺少必填参数"),
    NOT_OBJECT(28, "对象不存在"),


    ERROR_PASSWORD(30, "密码错误"),
    ERROR_GET_USER(31,"获取用户失败"),
    ERROR_TOKEN(32,"token失效，请重新登录"),
    ERROR_ILLEGAL_TOKEN(33,"token失效，请重新登录"),
    ERROR_USER_CLOSE(34, "当前用户已被冻结，请联系管理员"),
    ERROR_SIGN(35, "签名错误"),
    ERROR_IP_ADDRESS(36, "该IP不在白名单中"),
    ERROR_CODE(37, "验证码错误"),
    ERROR_CODE_EXPIRED(38, "验证码过期"),


    ERROR_UNUSUAL(40, "出现异常错误，请联系管理员！"),

    E_400(400, "请求处理异常，请稍后再试"),
    E_500(500, "请求方式有误,请检查 GET/POST"),
    E_501(501, "请求路径不存在"),
    E_502(502, "权限不足"),
    E_10008(10008, "角色删除失败,尚有用户属于此角色"),
    E_10009(10009, "账户已存在"),

    E_20011(20011, "登陆已过期,请重新登陆");


    private final int code;
    private final String desc;

    CodeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }
}
